package com.example.aboutspringboot.service;

import com.example.aboutspringboot.entity.Img;
import com.example.aboutspringboot.entity.Shop;
import com.example.aboutspringboot.mapper.ShopMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ShopService {

    @Resource
    private ShopMapper shopMapper;

    public List<Shop> selectShopAll() {
        return shopMapper.selectShopAll();
    }

    public List<Img> selectImgAll(){
        return shopMapper.selectImgAll();
    }

    public List<Img> selectImg(long id) {
        return shopMapper.selectImg(id);
    }

    public Shop selectShopById(long id) {
        return shopMapper.selectShopById(id);
    }

    //添加商品信息
    public int insertShop(Shop shop) {
        return shopMapper.insertShop(shop);
    }

    //添加商品图片信息
    public int insertImgSrc(Img img) {
        return shopMapper.insertImgSrc(img);
    }

    //修改商品信息
    public int updateShop(Shop shop) {
        return shopMapper.updateShop(shop);
    }

    //修改商品图片信息
    public int updateImgSrc(Img img) {
        return shopMapper.updateImgSrc(img);
    }

    //删除商品信息
    public int deleteShop(long id) {
        return shopMapper.deleteShop(id);
    }

    //删除商品图片信息
    public int deleteImgSrc(long id) {
        return shopMapper.deleteImgSrc(id);
    }
}
